<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>试用区-订单详情</title>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cropper.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />
	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="container page-single">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">订单详情</h3>
			</div>
			<div class="panel-body event-create">

				<form class="form-horizontal" id="trade_delivery_form" action="javascript:updateDeliveryNo()">
					<input type="hidden" name="tradeNo"  value="${tradeRecordVO.tradeNo}">
					<input type="hidden" name="tradeState"  value="${tradeRecordVO.tradeState}">
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							订单号
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${tradeRecordVO.tradeNo}
						</div>
						<label  class="col-sm-1 control-label">
							支付金额
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${tradeRecordVO.tradeAmount}
						</div>
					</div>
					
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							订单状态
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${tradeRecordVO.tradeStateName}
						</div>
						<label  class="col-sm-1 control-label">
							使用的券码名称
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${couponVO.couponName}
						</div>
					</div>
					
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							下单时间
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							<fmt:formatDate value="${tradeRecordVO.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>	
						</div>
						<label  class="col-sm-1 control-label">
							支付时间
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							<fmt:formatDate value="${tradeRecordVO.tradeTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</div>
					</div>
					
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							商品名称
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${goodsVO.goodsDetail}
						</div>
						<label  class="col-sm-1 control-label">
							选择的商品属性 
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${tradeRecordVO.selectProperty}
						</div>
					</div>
					
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							收货人 
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${tradeRecordVO.contactName}
						</div>
						<label  class="col-sm-1 control-label">
							联系电话 
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							${tradeRecordVO.contactPhone}
						</div>
					</div>
					
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							收货地址
						</label>
						<div class="col-sm-10" style="padding-top: 7px;">
							${tradeRecordVO.deliveryProvince}${tradeRecordVO.deliveryCity}${tradeRecordVO.deliveryRegion}${tradeRecordVO.deliveryAddress}
						</div>
					</div>
					
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							物流公司 
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							<input class="form-control event-create-form-control-block" maxlength="50" 
							name="deliveryCompany"  placeholder="物流公司" type="text" value="${tradeRecordVO.deliveryCompany}">
						</div>
						<label  class="col-sm-1 control-label">
							物流单号
						</label>
						<div class="col-sm-5" style="padding-top: 7px;">
							<input class="form-control event-create-form-control-block" maxlength="50" 
							name="deliveryNo"  placeholder="物流单号" type="text" value="${tradeRecordVO.deliveryNo}">
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-1 col-sm-10">
							<button type="submit" class="btn btn-primary" id="trade_manage_btn">更新物流信息</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<jsp:include page="/views/commons/footer.jsp"></jsp:include>
<script type="text/javascript">
	function updateDeliveryNo(){
		$("#trade_manage_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/admin/trade/updateDeliveryNo",
			type : "post",
			dataType : "json",
			data : $("#trade_delivery_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg(data.message,{icon: 1});
					$("#trade_manage_btn").removeClass("disabled").removeAttr("disabled").val("更新物流信息");
				}else{
					layer.msg(data.message,{icon: 2});
					$("#trade_manage_btn").removeClass("disabled").removeAttr("disabled").val("更新物流信息");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#trade_manage_btn").removeClass("disabled").removeAttr("disabled").val("更新物流信息");
			}
		});
	}
</script>
</body>
</html>